package com.kefu.model;

import org.apache.commons.lang.StringUtils;
import org.springframework.util.CollectionUtils;

import java.util.List;

/**
 * 客服基本信息
 */
public class Kefu {
    private String id ;
    private String  username;
    private String  password;
    private String  fullname;
    private String  docId;
    private List<String> jurisdictionIds;

    public String getId() {
        return id;
    }

    public String getUsername() {
        return username;
    }

    public String getPassword() {
        return password;
    }

    public String getFullname() {
        return fullname;
    }

    public String getDocId() {
        return docId;
    }

    public List<String> getJurisdictionIds() {
        return jurisdictionIds;
    }

    public void setId(String id) {
        this.id = id;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public void setFullname(String fullname) {
        this.fullname = fullname;
    }

    public void setDocId(String docId) {
        this.docId = docId;
    }

    public void setJurisdictionIds(List<String> jurisdictionIds) {
        this.jurisdictionIds = jurisdictionIds;
    }

    public String getJurisdictionIdsStr() {
        if(CollectionUtils.isEmpty(jurisdictionIds)) {
            return "";
        }
        StringBuilder s = new StringBuilder();
        for(String jurisdictionId : jurisdictionIds) {
            s.append(jurisdictionId);
            s.append("/");
        }
        return s.toString();
    }

    public void setJurisdictionIdsStr(String jurisdictionIdsStr) {
        if(StringUtils.isEmpty(jurisdictionIdsStr)) {
            return;
        }
        String[] jurisdictionIdsStrs = jurisdictionIdsStr.split(",");
        for(String jurisdictionIdStr : jurisdictionIdsStrs) {
            if(StringUtils.isEmpty(jurisdictionIdStr)) {
                continue;
            }
            getJurisdictionIds().add(jurisdictionIdStr);
        }
    }
}
